'''
1.创建保存图的状态的字典
2.创建智能体
3.创建带状态的图
4.添加节点 节点和智能体绑定
5.编译图
6.使用：通过图执行智能体和管理  invoke
'''

from typing import TypedDict
from langgraph.graph import StateGraph,START,END
class State(TypedDict):
    foo:int

def agent_01(state):
    return {"foo":state['foo']+1}

builder = StateGraph(State)

builder.add_node("node_01",agent_01)
print(START)
print(type(START))

builder.add_edge(START,"node_01")
builder.add_edge("node_01",END)

graph = builder.compile()

r = graph.invoke({"foo":10})
print(r)

print(graph.get_graph().draw_ascii())
graph.get_graph().draw_mermaid_png(output_file_path="hello_01.png")
